<template>
	<view class="messageCell">
		<view class="main" :class="{isMyself : item.isSelf}">
			<view class="absolute-view" v-show="showIndex>index?'show-index':''"></view>
			<image class="avatarUrl" :src="item.befrom.avatarUrl" mode="aspectFill" @click="click(item.befrom)"></image>
			<view class="messageCont">{{item.content}}</view>
			
		</view>
	</view>
</template>

<script>
	import {uploadApi, upload_baseUrl} from '@/api/baseUrl.js'
	export default{
		props:{
			item: {
				type: Object,
				default: {}
			}
		},
		data() {
			return {
				upload_baseUrl: upload_baseUrl
			}
		},
		methods:{
			click(item){
				this.$emit('avatarTap', item)
			}
		}
	}
</script>

<style lang="scss" scoped>
	$margin: 30rpx;
	$avatar_WH: 80rpx;
	$messageCont_W: 570rpx;
	.messageCell{
		display: flex;
		flex-direction: column;
		padding: $margin;
		.main{
			width: 690rpx;
			display: flex;
			flex-direction: row;
			.avatarUrl{
				width: $avatar_WH;
				height: $avatar_WH;
				background-color: #FFFFFF;
				border-radius: 20rpx;
			}
			.messageCont{
				max-width: 430rpx;
				padding: 20rpx;
				background-color: #FFFFFF;
				margin: 0 $margin;
				border-radius: 20rpx;
				display: flex;
				align-items: center;
				justify-content: center;
			}
		}
		.isMyself{
			flex-direction: row-reverse;
		}
	}
</style>
